'''
from os import path
print('__file__=',__file__)
parentPath = path.dirname(__file__)
print('parentPath=',parentPath)
toolPath = path.dirname(path.join(parentPath,'tool/init.py'))
print('toolPath=',toolPath)
from sys import path
path.append(toolPath)
from init import *
'''

from airtest.cli.parser import cli_setup
from airtest.core.api import *
from os import path
from configparser import ConfigParser

config = ConfigParser()
print('__file__', __file__)
pro_dir_path = path.abspath(path.join(path.dirname(__file__), '..'))
print('pro_dir_path=', pro_dir_path)
setting_path = path.abspath(path.join(pro_dir_path, 'src/setting.ini'))
print('setting_path=', setting_path)
config.read(setting_path)
ip = config["setting"]["ip"]
# target = config["setting"]["target"]
target = input('target:')


if not cli_setup():
    auto_setup(__file__,
               logdir=None,
               devices=[
                   "android://127.0.0.1:5037/192.168.0.{}:5555".format(ip),
               ]
               )

    from poco.drivers.android.uiautomation import AndroidUiautomationPoco
    poco = AndroidUiautomationPoco(
        use_airtest_input=True, screenshot_each_action=False)
    print("start...")

    from logging import getLogger, ERROR
    logger = getLogger("airtest")
    logger.setLevel(ERROR)
